<%-- 
    Document   : index
    Created on : Sep 15, 2011, 6:41:32 PM
    Author     : bi
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/main.css" />
        <link rel="stylesheet" type="text/css" href="css/login.css" />
        <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
        <%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
        <SCRIPT type="text/javascript">
            <!--
            function setDesc(desc,price) {
                var myText = document.getElementById("description");

                myText.innerHTML = "Description: "+desc+"<br/><br/>\nPrice:"+price+" VND\n";
            }
            -->
        </SCRIPT>
        <title>Login</title>
    </head>
    <body class="default">
        <div class="logo">MULTI LEVEL MANAGEMENT</div><br/>
        <c:import var="xml" url="WEB-INF/products.xml" charEncoding="UTF-8"/>
        <x:parse var="doc" xml="${xml}" scope="session"/>
        <div class="workarea">
            <h1>Các mặt hàng đang được bán:</h1>
            <div class="items">
                <table>
                    <tr>
                        <c:set var="count" value="0"/>
                        <x:forEach var="row" select="$doc//productList/*">
                            <c:set var="count" value="${count+1}"/>
                            <c:set var="imgid">
                                <x:out select="$row/id"/>
                            </c:set>
                            <c:set var="imgurl">
                                <x:out select="$row/image"/>
                            </c:set>
                            <c:set var="imgdesc">
                                <x:out select="$row/longdesc"/>
                            </c:set>
                            <c:set var="imgprice">
                                <x:out select="$row/price"/>
                            </c:set>
                            <td>
                                <div class ="imgitem" onmouseover="setDesc('${imgdesc}','${imgprice}')">
                                    <img id="${imgid}" src="${imgurl}" alt="${imgid}" ><br/>
                                    <x:out select="$row/shortdesc"/>
                                </div>
                            </td>
                            <c:if test="${count mod 6 == 0}">
                            </tr>
                            <tr>
                            </c:if>
                        </x:forEach>
                </tr>
                <tr>
                    <td colspan="6" >
                        <div id="description" class="itemtext">
                            Hover item to see description.
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="login">
        <form action="Controler" method="POST">
            <table>
                <tr class="title">
                    <td colspan="2">
                        Login Form
                    </td>
                </tr>
                <tr class="description">
                    <td>
                        Username:
                    </td>
                    <td>
                        <input class="textbox" type="text" name="txtUsername"/>
                    </td>
                </tr>
                <!--                    <tr class="description">
                                        <td>
                                            Password:
                                        </td>
                                        <td>
                                            <input class="textbox" type="password" name="txtPassword"/>
                                        </td>
                                    </tr>-->
                <% if (request.getAttribute("login") != null) {%>
                <tr>
                <span color="red">Username or password is incorrect!</span>
                </tr>
                <% }%>
                <tr class="description">
                    <td>
                        <button class="good" type="submit" name="btnAction" value="login" >
                            <img src="img/tick.png" alt=""/>
                            Login
                        </button>
                    </td>
                    <td>
                        <button class="average" type="reset">
                            <img src="img/cross.png" alt=""/>
                            Reset
                        </button>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</body>
</html>
